#pragma once

#include "Graphics.h"
#include "Clock.h"
#include "Character.h"
#include "Vector.h"

class Controller
{
private:
	Controller():Running(true)
	{WallClock.Init();}
	bool Running;
	Clock WallClock;
	Character * Player;
	Vector * AllThingsToDraw;
public:
	inline static Controller* Access()
	{static  Controller C;return &C;}

	bool Init();

	void Run();

};

bool Controller::Init()
{
	AllThingsToDraw = AllThingsToDraw->Create();
	Running = true;
	WallClock.Init();
	Player = Player->Create();
	AllThingsToDraw->Add(CHARACTER,(void*)Player);
	return true;
}

void Controller::Run()
{
	Graphics::Access()->Draw();
	Player->MoveTo(Cursor::Access()->Find());
	
	WallClock.Run();
	std::stringstream out;out << "\nX: " << Cursor::Access()->Find().X << "  Y: " << Cursor::Access()->Find().Y;
	std::string s = out.str();
	Graphics::Access()->AddToDebugText(s);
}